Trò chơi đua xe động vật trong UNITY Engine
114.670 lượt xem;
- Map.cs
- MapScreen /
- AnimalRacing /
- Scripts /
- Assets /
- project /
1 using System.Collections;
2 using System.Collections.Generic;
3 using UnityEngine;
4 using UnityEngine.UI;
5
6 public class Map : MonoBehaviour
7 {
8 [SerializeField]
9 int index;
10 [SerializeField]
11 Button startButton;
12
13 void Start()
14 {
15 int world = Data.getData(Data.KEY_WORLD_MAP);
16 Debug.Log("Check map " + world + "__" + index);
17 //startButton.interactable = (world > index);
18 //if (world > index)
19 //{
20 // startButton.interactable = false;
21 //}
22 //else
23 //{
24 // startButton.transition = Selectable.Transition.ColorTint;
25 //}
26 }
27
28 public void StartMap()
29 {
30 Debug.Log("Start map " + index);
31 Attr.currentWorld = index;
32 Scenes.Load(Scenes.LEVEL);
33 }
34
35 //void Update()
36 //{
37 // int world = Data.getData(Data.KEY_WORLD_MAP);
38 // if (Input.touchCount > 0)
39 // {
40 // //TouchPhase phase
41 // }
42 //}
43 }
2 using System.Collections.Generic;
3 using UnityEngine;
4 using UnityEngine.UI;
5
6 public class Map : MonoBehaviour
7 {
8 [SerializeField]
9 int index;
10 [SerializeField]
11 Button startButton;
12
13 void Start()
14 {
15 int world = Data.getData(Data.KEY_WORLD_MAP);
16 Debug.Log("Check map " + world + "__" + index);
17 //startButton.interactable = (world > index);
18 //if (world > index)
19 //{
20 // startButton.interactable = false;
21 //}
22 //else
23 //{
24 // startButton.transition = Selectable.Transition.ColorTint;
25 //}
26 }
27
28 public void StartMap()
29 {
30 Debug.Log("Start map " + index);
31 Attr.currentWorld = index;
32 Scenes.Load(Scenes.LEVEL);
33 }
34
35 //void Update()
36 //{
37 // int world = Data.getData(Data.KEY_WORLD_MAP);
38 // if (Input.touchCount > 0)
39 // {
40 // //TouchPhase phase
41 // }
42 //}
43 }
startButton.interactable = (world > index);
if (world > index)
{
startButton.interactable = false;
}
else
{
startButton.transition = Selectable.Transition.ColorTint;
}
void Update()
{
int world = Data.getData(Data.KEY_WORLD_MAP);
if (Input.touchCount > 0)
{
TouchPhase phase
}
}